//中国疫情数据

(function() {
    var myChart = echarts.init(document.querySelector(".bar .chart"));

    option = {

        color: ['#37a2da', '#9fe6b8', '#ffdb5c', '#ff9f7f', '#fb7293', '#8378ea', '#00d887'],
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} 例({d}%)"
        },

        series: [{
            name: '各地区累计确诊',
            type: 'pie',
            clockwise: false,
            startAngle: 90,
            radius: '35%',
            center: ['44%', '50%'],
            hoverAnimation: false,
            roseType: 'radius', //area
            data: [{
                    value: 335,
                    name: '东北地区'
                },
                {
                    value: 310,
                    name: '华北地区'
                },
                {
                    value: 234,
                    name: '华中地区'
                },

                {
                    value: 248,
                    name: '华东地区'
                },
                {
                    value: 218,
                    name: '华南地区'
                }, {
                    value: 135,
                    name: '西南地区'
                }, {
                    value: 100,
                    name: '西北地区'
                }
            ],

            label: {
                show: true,

                formatter: '{a|{b}}\n{hr|}',
                rich: {
                    hr: {
                        backgroundColor: '#ccc',
                        borderRadius: 10,
                        width: 0,
                        height: 10,
                        padding: [3, 3, 0, -16],

                    },
                    a: {
                        padding: [-35, 15, -20, 5],
                    }
                }
            },
            labelLine: {
                normal: {
                    length: 25,
                    length2: 20,
                    lineStyle: {
                        width: 1,
                    }
                }
            },

        }],
    }
    myChart.setOption(option);
    var count = [];

    //图表跟随屏幕自适应
    window.addEventListener('resize', function() {
        myChart.resize();
    })
})();